<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Module: Globalize::CoreExtensions::Float</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Module</strong></td>
          <td class="class-name-in-header">Globalize::CoreExtensions::Float</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../../../files/vendor/plugins/globalize/lib/globalize/localization/core_ext_rb.html">
                vendor/plugins/globalize/lib/globalize/localization/core_ext.rb
                </a>
        <br />
            </td>
        </tr>

        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">



   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000020">loc</a>&nbsp;&nbsp;
      <a href="#M000019">localize</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->

    <div id="section">





      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M000020" class="method-detail">
        <a name="M000020"></a>

        <div class="method-heading">
          <span class="method-name">loc</span><span class="method-args">()</span>
        </div>
      
        <div class="method-description">
          <p>
Alias for <a href="Float.html#M000019">localize</a>
</p>
        </div>
      </div>

      <div id="method-M000019" class="method-detail">
        <a name="M000019"></a>

        <div class="method-heading">
          <a href="#M000019" class="method-signature">
          <span class="method-name">localize</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Returns the integer in <a href="String.html">String</a> form, according to
the rules of the currently active locale.
</p>
<p>
Example: <tt>123456.localize -&gt; 123.456</tt> (German locale)
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000019-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000019-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/plugins/globalize/lib/globalize/localization/core_ext.rb, line 116</span>
116:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">localize</span>
117:         <span class="ruby-identifier">str</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">to_s</span>
118:         <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">str</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/^[\d\.]+$/</span>
119:           <span class="ruby-keyword kw">if</span> <span class="ruby-constant">Locale</span>.<span class="ruby-identifier">active?</span>
120:             <span class="ruby-identifier">active_locale</span> = <span class="ruby-constant">Locale</span>.<span class="ruby-identifier">active</span>
121:             <span class="ruby-identifier">delimiter</span> = <span class="ruby-identifier">active_locale</span>.<span class="ruby-identifier">thousands_sep</span>
122:             <span class="ruby-identifier">decimal</span>   = <span class="ruby-identifier">active_locale</span>.<span class="ruby-identifier">decimal_sep</span>
123:             <span class="ruby-identifier">number_grouping_scheme</span> = <span class="ruby-identifier">active_locale</span>.<span class="ruby-identifier">number_grouping_scheme</span>
124:           <span class="ruby-keyword kw">end</span>
125:           <span class="ruby-identifier">delimiter</span> <span class="ruby-operator">||=</span> <span class="ruby-value str">','</span>
126:           <span class="ruby-identifier">decimal</span>   <span class="ruby-operator">||=</span> <span class="ruby-value str">'.'</span>
127:           <span class="ruby-identifier">number_grouping_scheme</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">:western</span>
128: 
129:           <span class="ruby-identifier">int</span>, <span class="ruby-identifier">frac</span> = <span class="ruby-identifier">str</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">'.'</span>)
130:           <span class="ruby-identifier">number_grouping_scheme</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:indian</span> <span class="ruby-operator">?</span>
131:             <span class="ruby-identifier">int</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp re">/(\d)(?=((\d\d\d)(?!\d))|((\d\d)+(\d\d\d)(?!\d)))/</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">match</span><span class="ruby-operator">|</span>
132:               <span class="ruby-identifier">match</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">delimiter</span>} <span class="ruby-operator">:</span>
133:             <span class="ruby-identifier">int</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp re">/(\d)(?=(\d\d\d)+(?!\d))/</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">match</span><span class="ruby-operator">|</span> <span class="ruby-identifier">match</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">delimiter</span> }
134:           <span class="ruby-identifier">int</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">decimal</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">frac</span>
135:         <span class="ruby-keyword kw">else</span>
136:           <span class="ruby-identifier">str</span>
137:         <span class="ruby-keyword kw">end</span>
138:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>